<template>
  <div>
    <el-card>
      <h1>
        欢迎！{{ this.loginUser.username || '请' }}
        <el-button type="text" @click="$router.push('/login')" v-if="!loginUser.username">
          <h1>登录</h1>
        </el-button>
      </h1>
    </el-card>
  </div>
</template>

<script>
import {defineComponent} from 'vue'

export default defineComponent({
  name: "HomeView",
  data() {
    return {
      loginUser: {},
    }
  },
  mounted() {
    //获取当前登录用户
    this.loginUser = JSON.parse(localStorage.getItem("user")) || {}
  }
})
</script>

<style scoped>

</style>
